<template>
  <div class="map">
    <detail-section title="位置周边" more="查看更多周边信息">
      <template #content>
        <div class="baidu" ref="mapRef">

        </div>
      </template>
    </detail-section>
  </div>
</template>

<script setup>
import detailSection from "@/components/detail-section/detail-section.vue"
import { onMounted, ref } from 'vue';
const props = defineProps({
  position: {
    type: Object,
    default: () => ({})
  }
})
const mapRef = ref()
onMounted(() => {
  const map = new BMapGL.Map(mapRef.value); //创建地图实例
  const point = new BMapGL.Point(props.position.longitude, props.position.latitude);//创建坐标点
  const marker = new BMapGL.Marker(point);        // 创建标注   
  map.centerAndZoom(point, 15);
  map.addOverlay(marker) //添加遮盖物
})
</script>

<style lang="less" scoped>
.map {
  .baidu {
    width: 100%;
    height: 250px;


    #container {
      width: 100%;
      height: 100%;

    }
  }
}
</style>